import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Clase que crea todos los objetos y sus posiciones para el mundo 2
 * 
 * @author Oliverio Celestino Ochoa 
 * @version 1.0
 */
public class Nivel2 extends SWorld
{
    private int cajax;
    private int cajay;
     private int cont=1;
    /**
     * Constructor for objects of class Level2.
     * 
     */
    public Nivel2()
    {    
       
       super(700, 500, 1, 8000); 
        GreenfootImage bg = new GreenfootImage("mundo2.png");
       setScrollingBackground(bg);
       setMainActor(new Mochila(), 0, 0);
       mainActor.setLocation(10, 420);
       addObject(new Puntos(), 100,40, false );
                         
       cajax = Greenfoot.getRandomNumber( 8000 );
       cajay = Greenfoot.getRandomNumber( 400 );
       addObject(new Caja(), cajax, cajay);
       addObject(new Salida(), 4200,470);
       addObject(new Puntos(), 100,40, false );
       addObject(new Door(), 4350,343);
       
            
       for( int i = 0; i<15; i++ ){
           int x = Greenfoot.getRandomNumber(8000);
           int y = Greenfoot.getRandomNumber(400);
           addObject(new Misil(), x, y);
       }
                    
       for(int i=0; i<40; i++){
           int x = Greenfoot.getRandomNumber(8000);
           int y = Greenfoot.getRandomNumber(400);
                         
           addObject(new Monedas() ,x,y);
                        
       }
              
       for( int i = 0; i<15; i++ ){
           int x = Greenfoot.getRandomNumber(8000);
           int y = Greenfoot.getRandomNumber(400);
           int tipo = Greenfoot.getRandomNumber( 2 );
          if( tipo == 1 )
             addObject(new Obstaculo1(), x, y);
          else
             addObject( new Obstaculo2(), x, y);
       }
    }
      
    public void act()
    {
      super.act();
    }
    
}
